package net.zkbc.helloworld.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.zkbc.helloworld.dialect.AbstractUser;
import net.zkbc.helloworld.dialect.Schema.Tables;
import net.zkbc.shiro.entity.ShiroUser;

@Entity
@Table(name = Tables.USER)
public class User extends AbstractUser implements Serializable, ShiroUser {

	private static final long serialVersionUID = 1L;

	private String loginName;
	private String password;
	private String salt;
	private Date loginPasswordTime;

	@Transient
	private String plainPassword;
	@Transient
	private boolean disabled;
	@Transient
	private Set<String> roleNames;
	@Transient
	private Set<String> permissionNames;

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public Date getLoginPasswordTime() {
		return loginPasswordTime;
	}

	public void setLoginPasswordTime(Date loginPasswordTime) {
		this.loginPasswordTime = loginPasswordTime;
	}

	public String getPlainPassword() {
		return plainPassword;
	}

	public void setPlainPassword(String plainPassword) {
		this.plainPassword = plainPassword;
	}

	@Override
	public boolean isDisabled() {
		return false;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	@Override
	public Collection<String> getRoleNames() {
		return Collections.emptyList();
	}

	public void setRoleNames(Set<String> roleNames) {
		this.roleNames = roleNames;
	}

	@Override
	public Collection<String> getPermissionNames() {
		return Collections.emptyList();
	}

	public void setPermissionNames(Set<String> permissionNames) {
		this.permissionNames = permissionNames;
	}

}
